#include "StdAfx.h"
#include "NodeEntityBody.h"


NodeEntityBody::NodeEntityBody(Ogre::SceneNode * n, Ogre::SceneManager * scnMgr)
{
	node = n;
	sceneMgr = scnMgr;

}


NodeEntityBody::~NodeEntityBody(void)
{
	sceneMgr->destroySceneNode(node);
}


void NodeEntityBody::setPosition(Ogre::Vector3 position)
{
	lastPosition = position;
	node->_setDerivedPosition(position);
}

Ogre::Vector3 NodeEntityBody::getPosition()
{
	return node->_getDerivedPosition();
}

void NodeEntityBody::setOrientation(Ogre::Quaternion orientation)
{
	lastOrientation = orientation;
	node->_setDerivedOrientation(orientation);
}

Ogre::Quaternion NodeEntityBody::getOrientation()
{
	return node->_getDerivedOrientation();
}

void NodeEntityBody::setLocalPosition(Ogre::Vector3 position)
{
	node->setPosition(position);
}

Ogre::Vector3 NodeEntityBody::getLocalPosition()
{
	return node->getPosition();
}

void NodeEntityBody::setLocalOrientation(Ogre::Quaternion orientation)
{
	node->setOrientation(orientation);
}

Ogre::Quaternion NodeEntityBody::getLocalOrientation()
{
	return node->getOrientation();
}



void NodeEntityBody::setLookAt(Ogre::Vector3 target)
{
	node->lookAt(target,Ogre::Node::TS_WORLD);
}
	
Ogre::Vector3 NodeEntityBody::getFacingDir()
{
	Ogre::Quaternion ori = getOrientation();

	return ori*Ogre::Vector3::UNIT_Z;
}

Ogre::SceneNode*  NodeEntityBody::getParentNode()
{
	return node->getParentSceneNode();
}



void NodeEntityBody::addForce(Ogre::Vector3 force)
{
}

void NodeEntityBody::addTorque(Ogre::Vector3 torque)
{
}

void NodeEntityBody::killBody()
{
}
